fix(authz): protect purpose-bound runtime integrity - #65
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@opencode-agent Please review the current unchanged head against protected |
|
@coderabbitai review Please review exact head |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Exact revision =='
git rev-parse HEAD
git status --short
printf '%s\n' '== Merge base with develop =='
git merge-base HEAD develop
printf '%s\n' '== Changed files =='
git diff --name-status develop...HEAD
printf '%s\n' '== Python structure candidates =='
fd -e py . | xargs -r ast-grep outline --items all --type class,function --match 'AuthorizationDecision|Authorization|Decision' 2>/dev/null || true
printf '%s\n' '== Focused diff =='
git diff --find-renames --unified=80 develop...HEAD -- '*.py'Length of output: 44422 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '== Authorization module, complete numbered source =='
cat -n packages/keyverse-adapter/src/orgmetra_keyverse_adapter/authorization.py
printf '%s\n' '== Direct constructors and consumer references =='
rg -n -C 8 --glob '*.py' \
'(AuthorizationDecision\s*\(|\bAuthorizationDecision\b)' \
packages services
printf '%s\n' '== Existing adapter authorization tests =='
cat -n packages/keyverse-adapter/tests/test_authorization.py
printf '%s\n' '== Persistence-boundary authorization validation =='
sed -n '150,230p' services/people-api/src/orgmetra_people_api/postgres_hire.py
sed -n '1,260p' services/people-api/src/orgmetra_people_api/postgres_mutations.py
printf '%s\n' '== Decision construction test map =='
rg -n -C 5 --glob 'test_*.py' \
'(AuthorizationDecision\s*\(|_decision\s*\(|allowed=False|authorized_fields)' \
packages/keyverse-adapter/tests services/people-api/tests services/job-analysis-api/testsLength of output: 169233
High: Prevent
|
|
@coderabbitai review Please review exact head |
|
Owner-path update after the #268 source repair: canonical #64 is now exact |
|
Owner-order update: canonical #64 has advanced by ordinary forward commits to |
|
Fresh canonical #64 owner handoff: #270 adds a separate post-executable replay-verification invariant after #246/#269. The replay check must not reuse either a semantic command object or an |
|
Owner-path update after #271 revalidation: #64 ordinary-forward head |
|
#272 downstream handoff correction: when #65 eventually non-force adopts protected #64, preserve the PostgreSQL concurrency behavioral contract and evidence-tier boundary, but do not copy the current mutable test harness. Fresh review of #64 exact Also preserve the corrected evidence classification: deterministic synthetic structural rows may establish PostgreSQL mechanism/integration behavior, but they are not real/right-cleared buyer/scientific acceptance data. Do not inherit the superseded #271 Employment lock. |
|
#64 owner handoff — fresh exact source is now |
|
#64 / #272 owner-path handoff update: current #64 exact head |
Scope
Canonical Orgmetra purpose-bound authorization runtime-integrity lane. Policy authority remains an Orgmetra trusted-composition concern; Python value objects validate and detach authorization data but are not unforgeable capabilities against arbitrary code already executing in the service interpreter.
Protected base is
develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f; current exact head isb7f2b730b8b231aa28e485c655fd8cdf18007d46. Open · Draft · mechanically mergeable. This long-lived branch is an ordinary descendant carrying inherited mutable-stack deltas; predecessor evidence does not authorize this head.Current repair
Fresh review of predecessor
1caf8f760e81f1cb6954fdf1d0d13a46dbb6c0b1found that a retained exactuuid.UUIDcould expose a caller-controlled.intpayload to equality/range semantics before the retained scalar had been proved to be the exact built-inint.Test-first
a260e1c7e59cd0b9eed97f2b3a7e59280f99ccb5added an exact-UUID forged-payload regression. Its hosted Foundation run was superseded before runner admission, so no hosted RED is claimed for that test-only head.Ordinary child
b7f2b730b8b231aa28e485c655fd8cdf18007d46reads.intonce, validates exact built-inintplus the 128-bit UUID range before sentinel equality, and then carries only the detached scalar. This closes the checked-vs-used retained-scalar path without claiming same-process arbitrary-code isolation.The repair preserves the existing #65 authorization boundary: exact built-in UUID/text/frozenset validation, construction-time UUID detachment, policy/request revalidation at evaluation, exact coherent/non-subclassable
AuthorizationDecision, and durable-consumer decision revalidation retained in branch history.Current exact-head evidence
Foundation
34289116386is RED, but RCA isolates the failure outside the #65 authorization package.packages/keyverse-adaptercompleted 119 passed with 100% coverage. The later Job Analysis API suite failed three retained-datetime/timezone-runtime regressions (3 failed, 196 passed) at the shared HRIS aggregate-kernelensure_exact_utc_datetimeboundary. That is the #63 shared-kernel prerequisite and the durable #244 retained-value invariant; do not copy mutable #63 source into #65.Latest exact-head workflow read: SAST
34289116322SUCCESS, Security34289116372SUCCESS, Dynamic Code Quality34289108456SUCCESS, Required Noema34289115045SUCCESS, and merge scheduler34289114560SUCCESS. Strix34289115229remains in progress and Required OpenCode34289114784remains queued.CodeQL
34289116329is terminal FAILURE and reproduces the central publication/settlement ordering defect. Actions consumer job102271601195enforced failure at 23:14:02Z and Python consumer job102271601217at 23:14:03Z; authoritative current-head dispatch job102273249299did not begin until 23:17:33Z and then succeeded at 23:17:39Z. The exact consumer canary is handed to canonical.github#2040; do not rerun this unchanged head, poll/sleep, synthesize status, or move the defect into the Orgmetra leaf workflow.Fresh review enumeration has no qualifying independent
APPROVED; known inline review threads are resolved. Keep Draft.Stack and owner boundaries
Normal owner order remains #63 shared HRIS-kernel protected integration → #64 People mutation protected integration → #65 non-force protected adoption/reconciliation → #141/downstream consumers. #55 owns People reads. #100 alone edits
docs/product-technical-gap-baseline.md; its #244 already captures the nested retained-value invariant, so this lane does not create a competing baseline edit.Central required-workflow defects remain with their canonical owners, including #810 Dependency Review availability, #2040 CodeQL publication/settlement, and model-backed review infrastructure owners where applicable. Do not add direct provider/model/group pins or paid fallback.
No force push, destructive rebase, self/model approval, gate weakening, routine admin bypass, no-op retrigger, mutable sibling source copy, predecessor-verdict transfer, or premature Close.